package com.cn.suplayer.ui;

import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.media.ThumbnailUtils;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ListView;

import com.cn.suplayer.R;
import com.cn.suplayer.bean.VideoModel;

import java.util.List;

/**
 * Created by ZLM on 2016/6/16.
 * 目录详情
 */
public class DirectorDetailsActivity extends AppCompatActivity {


    private ListView listView;
    private DirectorDetailsAdapter adapter;
    private Context context;
    private List<VideoModel> modelList;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setContentView(R.layout.act_directordetails);

        context = getApplicationContext();
        listView = (ListView) findViewById(R.id.directorDetailsListView);
        modelList = (List) getIntent().getSerializableExtra("videos");
        adapter = new DirectorDetailsAdapter(context, modelList);

        listView.setAdapter(adapter);

        listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                Intent i = new Intent();
                i.putExtra("path", modelList.get(position).getPath());
                i.setClass(context, PlayerActivity.class);
                startActivity(i);
            }
        });

    }


}
